mod commands;
mod models;
mod parser;
mod state;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
  tauri::Builder::default()
    .manage(state::AppState::default())
    .setup(|app| {
      if cfg!(debug_assertions) {
        app.handle().plugin(
          tauri_plugin_log::Builder::default()
            .level(log::LevelFilter::Info)
            .build(),
        )?;
      }
      Ok(())
    })
    .invoke_handler(tauri::generate_handler![
        commands::load_sample_words,
        commands::parse_file_content,
        commands::update_config,
        commands::get_current_word,
        commands::speak_word,
        commands::next_word,
        commands::prev_word,
        commands::set_current_index,
        commands::get_progress,
        commands::reset_dictation,
        commands::set_playing
    ])
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}
